package com.bona.dubbo.system.impl;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.bona.dubbo.system.ISysRoleDubboSV;
import com.bona.model.system.SysDataRuleModel;
import com.bona.model.system.SysRoleFunctionModel;
import com.bona.model.system.SysRoleModel;
import com.bona.model.system.SysRoleUserModel;
import com.bona.service.system.SysCommonService;
import com.bona.service.system.SysDataRuleService;
import com.bona.service.system.SysFunctionService;
import com.bona.service.system.SysRoleService;
import com.bona.service.system.SysUserService;

public class SysRoleDubboSVImpl implements ISysRoleDubboSV {

	@Autowired
	private SysRoleService roleService;
	@Autowired
	private SysFunctionService functionService;
	@Autowired
	private SysCommonService commonService;
	@Autowired
	private SysUserService userService;
	@Autowired
	private SysDataRuleService dataRuleService;
	
	@Override
	public SysRoleModel query(SysRoleModel model) {
		return roleService.query(model);
	}
	
	@Override
	public void add(SysRoleModel model) {
		roleService.add(model);
	}
	
	@Override
	public List<SysRoleModel> queryByPage(SysRoleModel model) {
		
		List<SysRoleModel> roleModels = roleService.queryByPage(model);
		return roleModels;
	}

	@Override
	public Integer queryByCount(SysRoleModel model) {
		
		return roleService.queryByCount(model);
	}

	@Override
	public SysRoleFunctionModel queryRoleFunction(SysRoleFunctionModel model) {
		SysRoleFunctionModel roleFunctionModels = roleService.queryRoleFunction(model);
		return roleFunctionModels;
	}

	@Override
	public List<SysDataRuleModel> queryDataRuleByPage(SysDataRuleModel model) {
		List<SysDataRuleModel> dataRuleModels = dataRuleService.queryByPage(model);
		return dataRuleModels;
	}

	@Override
	public Integer queryRoleUserCount(SysRoleUserModel model) {
		return roleService.queryRoleUserCount(model);
	}

	@Override
	public void delete(String roleId) throws Exception {
		roleService.delete(roleId);
	}

	@Override
	public void addFunctionToRole(String roleId, String funcIds) throws Exception {
		roleService.addFunctionToRole(roleId, funcIds);
	}

	@Override
	public List<SysRoleModel> queryRoleByOrgId(String orgId) {
		
		List<SysRoleModel> models = roleService.queryRoleByOrgId(orgId);
		return models;
	}

	@Override
	public void updateRoleOrg(String orgId, String... roleIds) {
		roleService.updateRoleOrg(orgId, Arrays.asList(roleIds));
	}

	@Override
	public void addUserToRole(String roleId, String userIds) {
		roleService.addUserToRole(roleId, userIds);
	}

	@Override
	public void deleteRoleUser(SysRoleUserModel model) {
		roleService.deleteRoleUser(model);
	}

}
